import React, { Component } from "react";
import { Link, useNavigate } from "react-router-dom"

function myRoute(Component) {
    return (props) => (
        <Component
            {...props}
            navigate={useNavigate()}
        />
    );
}
class Onec extends Component {
    constructor() {
        super()
        this.state = {}
    }
    render() {
        return (
            <div>
                <h1><Link to="/twoc/1">商品1</Link></h1>
                <h1><Link to="/twoc/2">商品2</Link></h1>
                <h1 onClick={() => this.props.navigate('/twoc/3')}>商品3</h1>
                <h1 onClick={() => this.props.navigate('/twoc/4')}>商品4</h1>
            </div>
        )
    }
}

export default myRoute(Onec)